package com.example.lvsuo.controller;


import com.example.lvsuo.entity.Fy;
import com.example.lvsuo.entity.vo.FyVo;
import com.example.lvsuo.modal.Result;
import com.example.lvsuo.service.IFyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 心心念念
 * @since 2021-03-30
 */
@RestController
@RequestMapping("/fy")
public class FyController {
    @Autowired
    IFyService fs;

    @GetMapping
    Result queryFy(FyVo f){
        return Result.back(fs.queryFy(f));
    }

    @PostMapping
    Result addFy(@Valid Fy f){
        System.out.println(f);
        fs.save(f);
        return Result.back("成功");
    }
}

